<?php
	session_start();
	$string = "";
	$i = 0;
	while($i < 4)
	{
	$string[$i] = rand(0,9);
	$i++;
	}
	$bulid = $string[0].$string[1].$string[2].$string[3];
	$_SESSION['rand_code'] = $bulid;
    $dir = "fonts/";
    $image = imagecreatetruecolor(75, 20);
	$black = imagecolorallocate($image, 0, 0, 0);
	$color = imagecolorallocate($image, 57, 97, 209);
	$white = imagecolorallocate($image, 234, 235, 150);
    imagefilledrectangle($image,0,0,399,99,$white);
	imagettftext ($image, 10, 10, 24, 21, $color, $dir."verdana.ttf", $_SESSION['rand_code']);
    header("Content-type: image/png");
	imagepng($image);
?>